New method loadFromId() per brion's suggestion. Reverted newFromId() change.
authorYuri Astrakhan <yurik@users.mediawiki.org>
Mon, 2 Oct 2006 16:17:57 +0000 (16:17 +0000)
committerYuri Astrakhan <yurik@users.mediawiki.org>
Mon, 2 Oct 2006 16:17:57 +0000 (16:17 +0000)
includes/Revision.php

index 3c99d46..8ea4df2 100644 (file)
@@ -22,16 +22,13 @@ class Revision {
         * Returns null if no such revision can be found.
         *
         * @param int $id
-        * @param Database $db
         * @access public
         * @static
         */
-       public static function newFromId( $id, $db = null ) {
-               $conditions = array( 'page_id=rev_page', 'rev_id' => intval( $id ));
-               if (is_null($db))
-                       return Revision::newFromConds( $conditions );
-               else
-                       return Revision::loadFromConds( $db, $conditions );
+       public static function newFromId( $id ) {
+               return Revision::newFromConds(
+                       array( 'page_id=rev_page',
+                              'rev_id' => intval( $id ) ) );
        }
 
        /**
@@ -58,6 +55,21 @@ class Revision {
                               'page_title'     => $title->getDbkey() ) );
        }
 
+       /**
+        * Load a page revision from a given revision ID number.
+        * Returns null if no such revision can be found.
+        *
+        * @param Database $db
+        * @param int $id
+        * @access public
+        * @static
+        */
+       public static function loadFromId( &$db, $id ) {
+               return Revision::loadFromConds( $db,
+                       array( 'page_id=rev_page',
+                              'rev_id' => intval( $id ) ) );
+       }
+
        /**
         * Load either the current, or a specified, revision
         * that's attached to a given page. If not attached